<extend name="Public/base"/>
<block name="body">
    <div class="main-title">
        <h2>
            编辑商品
        </h2>
    </div>
    <form action="{:U('update')}" class="form-horizontal" method="post" enctype="multipart/form-data">
    <input type="hidden" name="id" value="{$res['id']}">
        <div class="form-item">
            <label class="item-label">
                商品名称
                <span class="check-tips">
                </span>
            </label>
            <div class="controls">
                <input class="text input-large" name="name" type="text" value="{$res['name']}">
                </input>
            </div>
        </div>

        <div class="form-item">
            <label class="item-label">
                商品描述
                <span class="check-tips">
                </span>
            </label>
            <div class="controls">
                <input class="text input-large" name="des" type="text" value="{$res['des']}">
                </input>
            </div>
        </div>

        <div class="form-item">
            <label class="item-label">
                分类
                <span class="check-tips">
                </span>
            </label>
            <div class="controls" ">
                <select name="sort" class="drop">
                    <option value="">请选择分类</option>
                    <foreach name="res1" item="vo">
                    <option value='{$vo.id}'>{$vo.title}</option>
                    </foreach>
                </select>
            </div>
        </div>
        

        <div class="form-item">
            <label class="item-label">
                热销
                <span class="check-tips">
                </span>
            </label>
            <div class="controls">
                <label class="radio">
                    <input class="" name="hot" type="radio" value="0" {$res['status']?'':'checked'}>
                   普通
                    </input>
                </label>
                <label class="radio">
                    <input  class="" name="hot" type="radio" value="1" {$res['status']?'checked':''}>
                    热销商品
                    </input>
                </label>
            </div>
        </div>

        <div class="form-item">
            <label class="item-label">
                上架
                <span class="check-tips">
                </span>
            </label>
            <div class="controls">
                <label class="radio">
                    <input class="" name="up" type="radio" value="1" {$res['status']?'':'checked'}>
                    上架中
                    </input>
                </label>
                <label class="radio">
                    <input  class="" name="up" type="radio" value="0" {$res['status']?'checked':''}>
                    未上架
                    </input>
                </label>
            </div>
        </div>

        <div class="form-item">
            <label class="item-label">
                商品图片
                <span class="check-tips">
                </span>
            </label>
            <div class="controls">
                <input class="text input-large" name="pic" type="file" value="{$res['pic']}">
                </input>
            </div>
        </div>
        <div class="form-item">
            <label class="item-label">
                状态
                <span class="check-tips">
                </span>
            </label>
            <div class="controls">
                <label class="radio">
                    <input class="" name="status" type="radio" value="0" {$res['status']?'':'checked'}>
                    隐藏
                    </input>
                </label>
                <label class="radio">
                    <input  class="" name="status" type="radio" value="1" {$res['status']?'checked':''}>
                    显示
                    </input>
                </label>
            </div>
        </div>
        <div class="form-item">
            <button class="btn submit-btn " id="submit" target-form="form-horizontal" type="submit">
                确 定
            </button>
            <button class="btn btn-return" onclick="javascript:history.back(-1);return false;">
                返 回
            </button>
        </div>
    </form>
</block>
<block name="script">
<script>
    
   $(".controls").on('change','.drop',function(){
        // alert(111);
        var t=$(this);
        var id=t.val();
        var url="{:U('ajax')}";
        $.get(url,{fid:id},function(data){
            if(data.status ==1){
            t.nextAll().remove();
            t.after(data.res);
            }
        });
    })
</script>

    <script type="text/javascript">
        //导航高亮
        highlight_subnav('{:U('
        User / index
        ')}'
        )
        ;
    </script>
</block>